package com.xunji.user.dto;

import com.xunji.user.entity.Menu;
import lombok.Data;

import java.util.ArrayList;
import java.util.List;

@Data
public class MenuDto {

    private Integer id;

    private String name;

    private Integer pId;

    private Integer weight;

    private String uri;

    private String pinYin;

    List<MenuDto> children = new ArrayList<>();

    public static MenuDto getInstance(Menu menu){
        MenuDto menuDto = new MenuDto();
        menuDto.setId(menu.getId());
        menuDto.setName(menu.getName());
        menuDto.setPinYin(menu.getPinYin());
        menuDto.setPId(menu.getPId());
        menuDto.setWeight(menu.getWeight());
        menuDto.setUri(menu.getUri());
        return menuDto;
    }

}
